using System;
using System.Collections.Generic;
using System.Text;

using GameMap;
using System.IO;
using System.Xml.Serialization;
using AI.AStar;

namespace TestGameMap
{
    class Program
    {
        static void Main(string[] args)
        {
            StationsNetwork game_map = new StationsNetwork();

            XmlSerializer mySerializer = new XmlSerializer(typeof(StationsNetwork));
            // To write to a file, create a StreamWriter object.
            StreamReader myReader = new StreamReader(@"..\..\..\GameData\TenNodeTestMap.sym");
            game_map = (StationsNetwork)mySerializer.Deserialize(myReader);
            myReader.Close();

            System.Console.WriteLine("Enter start Station (1 to 10): ");
            int start = Int32.Parse(System.Console.ReadLine());
            System.Console.WriteLine("Enter destination Station (1 to 10: ");
            int destination = Int32.Parse(System.Console.ReadLine());

            List<IAStarNode> path = AStarPathfinder.FindShortestPath(game_map.Stations[start - 1], game_map.Stations[destination - 1], (IAStarSearchSpace)game_map);

            foreach (IAStarNode node in path)
            {
                Console.Write("{" + ((Station)node).StationID + "} ->");
            }

            System.Console.ReadLine();
        }
    }
}
